using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using UnitShared;

namespace UnitParser
{

    [ContentTypeWriter]
    public class UnitContentTypeWriter : ContentTypeWriter<UnitTemplate>
    {
        protected override void Write(ContentWriter output, UnitTemplate value)
        {
            output.Write(value.Texture);
            output.Write(value.Name);
            output.Write(value.Faction);
            output.Write(value.Description);
            output.Write(value.Types);
            output.Write(value.PointCost);
            output.Write(value.Hp);
            output.Write(value.Speed);
            output.Write(value.Attack);
            output.Write(value.Magic);
            output.Write(value.Defense);
            output.Write(value.MagicDefense);
            output.WriteObject<List<UnitTemplate.AbilityUses>>(value.Abilities);
            output.Write(value.MovementType);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(UnitContentReader).AssemblyQualifiedName;
        }
    }
}
